<#import "/META-INF/spring.ftl" as spring />
<#import "/META-INF/mspring.ftl" as mspring />
<#include "../header.ftl" />
<@head title="碎碎念 - ${sitename}"/>
	<@nav current="碎碎念"/>
	<div class="container">
		<div class="grid grid-20 last">
			<script type="text/javascript" src="${base}/script/jquery.form.js"></script>
			<script type="text/javascript" src="${template_url}/script/twitter.js"></script>
			<#if currentUser?exists>
				<form id="twitterPostForm" class="textbox" action="<@userSpaceUrl name=currentUser.name />/admin/t/add" method="POST">
					<div class="tb">
						<div class="txt">
							<textarea name="content" id="content" autofocus="autofocus" rows="3"></textarea>
						</div>
						<table style="width: 100%;" cellpadding="0" cellspacing="0">
							<tr>
								<td valign="top" id="twitterInsertTbLeft">
									<div class="ins">
										<a class="emotion" hidefocus="hidefocus" href="javascript:showEmotion('twitter', 'twitterInsertTbLeft', 'content');">表情</a>
									</div>
								</td>
								<td align="right" width="80" id="twitterInsertTbRight">
									<span class="btn" onclick="addTwitter();">发表</span>
								</td>
							</tr>
						</table>
					</div>
				</form>
			</#if>
			<form name="twitterForm" id="twitterForm" action="${base}/t" method="GET">
				<@spring.bind "twitterPage" />
				<!-- pagination parameter -->
				<@spring.formHiddenInput path="twitterPage.pageNo" />
				<@spring.formHiddenInput path="twitterPage.totalPages" />
				<@spring.formHiddenInput path="twitterPage.totalCount" />
				<!-- sorter parameter -->
				<@spring.formHiddenInput path="twitterPage.sortEnable" />
				<@spring.formHiddenInput path="twitterPage.sort.field" />
				<@spring.formHiddenInput path="twitterPage.sort.order" />
				
				<div id="medias" class="sep">
		    		<#if (twitterPage?exists && twitterPage.result?size > 0)>
			        	<#list twitterPage.result as twitter>
			        		<div class="media" id="twitter_${twitter.id}">
			        			<a href="#" class="media-cap"><img src="<@avatar avatar=twitter.author.smallAvatar />" class="img-radius"></a>
			        			<div class="media-body">
			        				<div class="media-body-title">
			        					<strong><a href="<@userSpaceUrl name=twitter.author.name />" target="_blank">${twitter.author.alias}</a>：</strong>
			        				</div>
			        				<p class="typo-small twitter-content">${twitter.content}</p>
			        				<p class="typo-small">
			        					发表于：${twitter.createTime}
		        						<a href="javascript:showReply(${twitter.id}, '${twitter.author.alias}');">回复</a>
		        						<#if mine?has_content && mine == true>
		        						<a href="javascript:delTwitter(${twitter.id});">删除</a>
		        						</#if>
			        				</p>
			        			</div>
			        			<div class="t_reply" id="t_reply_${twitter.id}">
									<div class="arrow">
									</div>
									<div>
					    				<textarea id="reply_txt_${twitter.id}" data-id="${twitter.id}" class="t_reply_txt" placeholder="回复${twitter.author.alias}"></textarea>
					    				<ul class="tool">
						                	<li class="left" id="reply_eminsert_${twitter.id}">
						                		<a class="emotion" hidefocus="hidefocus" href="javascript:showEmotion(${twitter.id}, 'reply_eminsert_${twitter.id}', 'reply_txt_${twitter.id}');">表情</a>
						                	</li>
						                	<li class="right"><input type="button" class="button button-inline" value="回复" onclick="replyTwitter(${twitter.id});" /></li>
						                </ul>
									</div>
									<div id="reply_div_${twitter.id}">
										
									</div>
								</div>
			        		</div>
				    	</#list>
				    <#else>
				    	<a class="listpub" id="listpub" href="javascript:void(0);" class="sep"><i class="icon-plus"></i><span>&nbsp;暂无碎碎念</span></a>
		        	</#if>
		        </div>
			    <#if (twitterPage.totalPages > 1)>
                    <@web.pagenavi pageEntity=twitterPage baseUrl="${base}/t?pageNo=$page$" />
                </#if>
			</form>
		</div>
	</div>
<#include "../footer.ftl" />